<?php

require_once 'PipesImpl/Model/Meta/Column.php';

class Pipes_Model_Meta_Column implements PipesImpl_Model_Meta_Column
{
    private $_data = array();
    
    public function __construct(PipesImpl_Database_Reflection_Column $column, array $overrides = array())
    {
        $this->_data = array(
            'name' => $column->getName(),
            'type' => $column->getType(),
            'size' => $column->getLength(),
            'visible'  => !$column->isTableId(),
            'required' => $column->isRequired(),
            'default' => $column->getDefault()
        );
        
        $this->_data = array_merge($this->_data, $overrides);

        if (empty($this->_data['label'])) {
            $this->_data['label'] = $this->_data['name'];
        }
    }
    
    public function __get($key)
    {
        return $this->_data[$key];
    }
}
